package com.madou.yy.newyear;

import javax.swing.*;
import java.awt.*;
import java.io.IOException;

public class NewYear {

    TimePanel jPanel;

    public NewYear() throws IOException {
        // - 如何创建JFrame窗口？
        JFrame jFrame = new JFrame("元旦倒计时");
        jFrame.setVisible(true);//设置窗口可见
        jFrame.pack();// 立即显示出来
        jFrame.setSize(new Dimension(800,500));
        // - 如何关闭窗口？——退出窗口
        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jFrame.setLayout(new BorderLayout());

        //  - 如何创建JPanel面板？
        jPanel = new TimePanel();
        jFrame.add(jPanel,BorderLayout.CENTER);

        jPanel.start();
        jFrame.repaint();
    }

    public static void main(String[] args) throws IOException {
        new NewYear();
    }


}
